package org.yiqixue.accounts.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;

public class TransactionDTO {

    @Schema(description = "交易ID（系统自动生成，创建时无需传入）", example = "1")
    private Long transactionID;

    @Schema(description = "账户号码", required = true, example = "123456789")
    private Long accountNumber;

    @Schema(description = "交易金额", required = true, example = "100.50")
    private double amount;

    @Schema(description = "交易时间（格式：yyyy-MM-dd HH:mm:ss）", example = "2025-04-06 12:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime transactionDate;

    @Schema(description = "交易描述", example = "工资入账")
    private String description;

    @Schema(description = "交易状态", allowableValues = {"PENDING", "COMPLETED", "FAILED"}, example = "PENDING")
    private String status;

    @Schema(description = "交易类型", allowableValues = {"DEPOSIT", "WITHDRAWAL", "TRANSFER"}, example = "DEPOSIT")
    private String type;

    @Schema(description = "关联手机号", required = true, example = "13800138000")
    private String phoneNumber;

    // 全参构造函数（用于手动构建对象）
    public TransactionDTO(Long transactionID, Long accountNumber, double amount,
                          LocalDateTime transactionDate, String description,
                          String status, String type, String phoneNumber) {
        this.transactionID = transactionID;
        this.accountNumber = accountNumber;
        this.amount = amount;
        this.transactionDate = transactionDate;
        this.description = description;
        this.status = status;
        this.type = type;
        this.phoneNumber = phoneNumber;
    }

    // 无参构造函数（Spring框架必须）
    public TransactionDTO() {
    }

    // ========== 以下是所有Getter和Setter方法 ==========
    public Long getTransactionID() {
        return transactionID;
    }

    public void setTransactionID(Long transactionID) {
        this.transactionID = transactionID;
    }

    public Long getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(Long accountNumber) {
        this.accountNumber = accountNumber;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public LocalDateTime getTransactionDate() {
        return transactionDate;
    }

    public void setTransactionDate(LocalDateTime transactionDate) {
        this.transactionDate = transactionDate;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }
}